//CFG.h
//zhunan 2010-3-15
#ifndef CFG_H
#define CFG_H
#include <iostream>
#include <vector>
#include "crossbit/VBlock.h"
using namespace std;
namespace crossbit
{
	class CFG
	{
		public:	
			typedef struct __cfg_node__
			{
				int source_id;
				int next_block[2];
				int path_num;
				VBlock * vb;
			}CFG_Node;

		public:
			int Add_CFG_Node(int Source_id, VBlock *vblock);//add a new node in the node list;
			void Print_CFG();//print the CFG

			int next_block_exist(int current_pos,int path_num,int node_position);//
			int next_block_exist(int path_num,int node_position);//
			int Get_last_node()
			{
				return last_node;
			}
			int Set_last_node(int node_pos)
			{
				last_node=node_pos;
				return last_node;
			}

			vector<CFG_Node> CFG_Store;//CFG
			CFG();
			~CFG();
		private:
			int Node_Num;
			CFG_Node *head,*p;
			int last_node;//indicate the position of the node which is accessed most recently



	};

}
#endif
